import os
import time

import alert as alert
from selenium import webdriver
from selenium.webdriver.common.by import By

# print(os.path.abspath(__file__))
# print(os.path.dirname(os.path.abspath(__file__)))
# exit(0)

# 实例化配置类
options = webdriver.ChromeOptions()
# 准备配置信息
download = os.path.join(os.path.dirname(os.path.abspath(__file__)), "download")
prefs = {
    'profile.default_content_settings.popups':0, # 取消弹窗
    'download.default_directory':download  # 设置保存位置
}
# 添加配置
options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(options=options)
driver.get("https://www.cr173.com/soft/31043.html")
driver.find_element(By.LINK_TEXT, "本地电信下载").click()

time.sleep(2)
driver.quit()
